package com.mall.admin.exception;

import com.mall.commons.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler(BusinessException.class)
    public R handlerException(BusinessException be){
        return R.error(500,be.getMessage());
    }
    @ExceptionHandler(Exception.class)
    public R otherException(Exception e){
        return R.error(500,"未知错误");
    }
}
